package club.janna.concurrency.example.singleton;

import club.janna.concurrency.annotation.ThreadUnSafe;

/**
 * 单例模式-懒汉模式
 * 第一次使用时进行初始化
 * @Auther: guopanbo
 * @Date: 2018/8/1 21:49
 * @Description:
 */
@ThreadUnSafe
public class SingletonExample2 {

    private SingletonExample2() {}

    private static SingletonExample2 instance = null;


    public static SingletonExample2 getInstance() {
        if(instance == null)
            instance = new SingletonExample2();
        return instance;
    }
}
